﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
using System.Text;

namespace YXShop.Web.admin.include
{
    public partial class shopstyle_ajax : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Response.CacheControl = "no-cache";
                Response.Expires = 0;
                StyList.InnerHtml = GetStyle();
            }
        }

        private string GetStyle()
        {
            YXShop.BLL.Shop.ShopColor colorBll = new YXShop.BLL.Shop.ShopColor();
            List<YXShop.Model.Shop.ShopColor> list = colorBll.GetALL(" isstate=1 ");
            StringBuilder shtml = new StringBuilder();
            if (list != null)
            {
                shtml.Append("<table width='100%'>");
                shtml.Append("<tr>");
                int count = 0;
                YXShop.Common.SysParameter sp = new YXShop.Common.SysParameter();
                foreach (YXShop.Model.Shop.ShopColor item in list)
                {
                    count++;
                    shtml.Append("<td>");
                    shtml.Append("<table  bgcolor=\"#F5F5F5\" width=\"100px\" border=\"0\" cellspacing=\"4\" cellpadding=\"4\">");
                    shtml.Append("<tr>");
                    shtml.Append("<td><span style=\"cursor:hand\" id=\"" + item.Id + "\" onClick=\"SelectLable(this);sFiles('" + item.Id + "','" + item.Name + "');\"><img src=\"" + sp.DummyPaht + item.Samplemappath + "\" alt=\"\" width=\"100px\" height=\"116px\"/> </span></td>");
                    shtml.Append("</tr>");
                    shtml.Append("<tr>");
                    shtml.Append("<td align=\"center\"><span id=\"" + item.Id + "\" class=\"LableItem\"  onClick=\"SelectLable(this);sFiles('" + item.Id + "','" + item.Name + "');\">" + item.Name + "</span></td>");
                    shtml.Append("</tr>");
                    shtml.Append("</table>");
                    shtml.Append("</td>");
                    if (count % 2 == 0)
                    {
                        shtml.Append("</tr><tr>");
                    }
                }
                shtml.Append("</tr>");
                shtml.Append("</table>");
            }
            return shtml.ToString();
        }
    }
}
